﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DiracTCC.Business
{
    public class VideoInfo
    {
        public Chroma Chroma { get; set; }
        public int[] VideoSize { get; set; }
        public int[] FrameRate { get; set; }
        public int[] PixelAspectRatio { get; set; }
        public SourceSampling SourceSampling { get; set; }
        public TopFieldFirst TopFieldFirst { get; set; }
        public PictureCodingMode PictureCodingMode { get; set; }
        public int NumberOfFrames { get; set; }
        public int NumL1 { get; set; }
        public int L1Sep { get; set; }
        public double QF { get; set; }
        public string CodingInfo
        {
            get
            {
                return GetCodingString();
            }
        }

        public VideoInfo()
        {
            VideoSize = new int[2];
            FrameRate = new int[2];
            PixelAspectRatio = new int[2];
        }

        private string GetCodingString()
        {
            string topFieldFirst = string.Empty;
            string sourceSampling = string.Empty;

            if (SourceSampling == SourceSampling.Progressivo)
            {
                sourceSampling = "progressiva";
            }
            else
            {
                sourceSampling = "entrelaçada";

                if (TopFieldFirst == TopFieldFirst.BottonFieldFirst)
                {
                    topFieldFirst = "(Botton field first)";
                }
                else
                {
                    topFieldFirst = "(Top field first)";
                }
            }


            return string.Format("{0}, {1} {2}", 
                this.PictureCodingMode.ToString(), sourceSampling, topFieldFirst);
        }
    }
}
